#ifndef COMMAND_H
#define COMMAND_H

#include <QObject>
#include <QMap>

enum COMMANDCLASSTYPE{
    COMMON, PROGFLOW, VARIOUS, SETTING, MOTIONPROC, IO,
    COMMUNICATE, INTERRUPTS, ERRORREC, SYSTEM_TIME,
    MATHEMATICS, MOTIONSETADV, MOTIONADV, EXTCOMPUTER,
    MULTITASKING, RAPIDSUPPORT, CALIBSERVICE, MC1, MC2, MC3
};

enum MOTION_PROC{
    ACTUNIT, DEACTUNIT, MOVEABSJ, MOVEC, MOVECAO,
    MOVECDO, MOVECGO, MOVEEXTJ, MOVEJ, MOVEJAO,
    MOVEJDO, MOVEJGO, MOVEL, MOVELAO, MOVELDO,
    MOVELGO, SEARCHC, SEARCHEXTJ, SEARCHL
};

class Command : public QObject
{
    Q_OBJECT
    Q_ENUMS(COMMANDCLASSTYPE)
    Q_ENUMS(MOTION_PROC)

    Q_PROPERTY(int classFlag READ classFlag WRITE setClassFlag NOTIFY classFlagChanged)
    Q_PROPERTY(int commandFlag READ commandFlag WRITE setCommandFlag NOTIFY commandFlagChanged)
    Q_PROPERTY(QStringList variableList READ variableList)
    Q_PROPERTY(QString commandName READ commandName WRITE setCommandName NOTIFY commandNameChanged)
public:
    explicit Command(QObject *parent = 0);

    QMap<QString, int> map_motion;

    int classFlag() const;
    void setClassFlag(const int &classFlag);

    int commandFlag() const;
    void setCommandFlag(const int &commandFlag);

    QStringList variableList() const;
    Q_INVOKABLE void addVariableList(const QString & variable);
    Q_INVOKABLE QString getShowData();
    Q_INVOKABLE void dealShowData(QString code);

    QString commandName() const;
    void setCommandName(const QString & commandName);

    void initMap(QMap<QString, int> map, QString sql);
signals:
    void classFlagChanged(const int & classFlag);
    void commandFlagChanged(const int & commandFlag);
    void commandNameChanged(const QString & commandName);

public slots:

private:
    int m_classFlag, m_commandFlag;
    //参数
    QStringList m_variableList;
    QString m_commandName;
    QMap<QString, int> *map_commonclass;
};

#endif // COMMAND_H
